package zheng.mockit.plugin;

import zheng.mockit.compare.DefaultMessageCompare;
import zheng.mockit.compare.IMessageCompare;

/**
 * Created by zcz on 16-7-29.
 */
public abstract class AbstractServer extends AbstractPlugin implements IServer {

    private static final long DEFAULT_TIMEOUT = 3000L;
    @Override
    public void assertRequest(Object message) {
        assertRequest(message, DEFAULT_TIMEOUT, new DefaultMessageCompare());
    }

    @Override
    public void assertRequest(Object message, long timeout) {
        assertRequest(message, timeout, new DefaultMessageCompare());
    }

    @Override
    public void assertRequest(Object message, IMessageCompare compare) {
        assertRequest(message, DEFAULT_TIMEOUT, compare);
    }

    @Override
    public void assertRequest(Object message, long timeout, IMessageCompare compare) {
        Object inMsg = messageHandler.getMessageFromPlugin(timeout);
        compare.compare(inMsg, message);
    }
}
